package com.qianxx.component.activity.effects.view_filpper;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.ViewFlipper;

import com.qianxx.component.R;
import com.qianxx.component.activity.base.BaseActivity;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ViewFlipperActivity extends BaseActivity {

    @BindView(R.id.viewFlipper)
    ViewFlipper viewFlipper;

    List<String> news = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_view_flipper);
        ButterKnife.bind(this);

        news.add("小米港股上市，第一天破发！");
        news.add("法国时隔20几年后重捧世界杯，重回巅峰");
        news.add("中美贸易争端持续延烧，多国抵制美国关税政策");

        for (String s : news) {
            View view = View.inflate(this, R.layout.child_view, null);
            TextView content = view.findViewById(R.id.tv_content);
            content.setText(s);
            viewFlipper.addView(view);
        }

        viewFlipper.startFlipping();
        //viewFlipper.stopFlipping();
    }

    @Override
    public String setTitle() {
        return "ViewFlipper";
    }
}
